<template>
<div class="apply-success-container">
   <div class="apply-success-wrap">
      <div class="apply-success-name">
          <img src="../../assets/images/success.png">
          <h3>报名成功</h3>
          <div>
            核销码
            <p v-for="item in orderInfo.stub_list" track-by="$index">
            {{ item.e_ticket_number}}[{{item.verified ? '已核销' :'未核销'}}]
            </p>
          </div>
      </div>
      <div class="course-info apply-info apply-info-detail">
         <div class="clearfix">
             <div class="title">活动名称</div>
             <div class="name">{{orderInfo.productname || orderInfo.title || orderInfo.ticket}}</div>
         </div>
         <div class="apply-name">
              票种
              <span>{{orderInfo.ticket}}</span>
         </div>
         <div>
              数量
              <span>{{query.count || 1}}张</span>
         </div>
         <div>
              票价
             <span>￥{{orderInfo.price}}</span>
         </div>
         <div>
              姓名
              <span>{{orderInfo.contacts}}</span>
         </div>
         <div>
               电话
               <span>{{orderInfo.phone_number}}</span>
         </div>
         <div>
               报名时间
               <span>{{orderInfo.order_time}}</span>
         </div>
      </div>
   </div>
</div>

</template>

<script>
    import { ORDER_INFO,ORDER_DETAIL } from '../../api';
    export default {
        data(){
            return{
              query:this.$route.query,
              orderInfo:{}
            }
        },
        methods:{
          getOrderInfo(){
            this.$http.get(ORDER_INFO,{
              orderid:this.query.orderId
            })
            .then(res =>{
                if(res.data.code ==0){
                  this.orderInfo = res.data.data; 
                }else{
                  this.$toast.show(res.data.message);
                }
            })
          },
          getActivityInfo(){
            this.$http.get(ORDER_DETAIL,{
              activity_id:this.query.activityId
            })
            .then(res =>{
                if(res.data.code ==0){
                  this.orderInfo = res.data.data; 
                  this.orderInfo.stubs = [1,2,3,3,4]
                }else{
                  this.$toast.show(res.data.message);
                }
            })
          }
        },
        ready(){
          if(this.$route.query.activityId){
            this.getActivityInfo()
          }else{
            this.getOrderInfo();
          }
        },
        components:{

        }
    }
</script>
<style lang="sass">
     @import "../../sass/apply.scss";
</style>
